UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RxBqM3XUfDFi1qGZUkiUdZx2uUHgxYeEolmh2Qw3/eI=' 
WHERE 
  key_id = '87c42b4ddd3279b47eac5dc4848dfe44af6448bf207d79a15697259ca0655334' 
  AND (
    token = 'RxBqM3XUfDFi1qGZUkiUdZx2uUHgxYeEolmh2Qw3/eI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046