UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PgZD3N37ZmPhQ/IoymEVtCH6GfOvCZZH7CT3ZJo6NtE=' 
WHERE 
  key_id = '92ced8ec5f162d5280ef1cfb1003020870312fb64097107ce6ceeb773f1787ec' 
  AND (
    token = 'PgZD3N37ZmPhQ/IoymEVtCH6GfOvCZZH7CT3ZJo6NtE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034