UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lC1+g0ioiqnncTVNDUftALyuyjXlcN+P4NDakjR0rK4=' 
WHERE 
  key_id = '244bc5b0a8d12c1f4f7d85399f8d2e269bbe7b84525ad9aa7e19510187b46a7e' 
  AND (
    token = 'lC1+g0ioiqnncTVNDUftALyuyjXlcN+P4NDakjR0rK4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019