UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v7rhzTXkP+c833Lyuwwgfb88Bc1CT+vR4AeY9VgfonE=' 
WHERE 
  key_id = '866cd5ad5a15504f3e5a2296ad03ec99cfedad38c752776227b8fbfa5f5a5fb2' 
  AND (
    token = 'v7rhzTXkP+c833Lyuwwgfb88Bc1CT+vR4AeY9VgfonE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030