UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BhzulxGFmV1EtKYVa69qTaNd1maDFPyj29jLzJc3fy4=' 
WHERE 
  key_id = '37a8d9e8d5b5e0daa9c4667f0897e4e36412ba19b6553701b30baaa625399903' 
  AND (
    token = 'BhzulxGFmV1EtKYVa69qTaNd1maDFPyj29jLzJc3fy4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036