UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PQtAVf7PRAY0Syu/T6ZfyPZtnuz3xJYCDh2tUHsZ4kI=' 
WHERE 
  key_id = '7d99fab02a511f949f30c2983fa7fb90b9f523580243197bfb284eb37c4b3116' 
  AND (
    token = 'PQtAVf7PRAY0Syu/T6ZfyPZtnuz3xJYCDh2tUHsZ4kI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040