UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xnudAr4gtL161tT/cXXqMLFVnDqhCdykfU2UdEcYkQY=' 
WHERE 
  key_id = 'e34fdc6548f04d6ecb855598603d8520b2138307736a6c1517a61f1ab04a9443' 
  AND (
    token = 'xnudAr4gtL161tT/cXXqMLFVnDqhCdykfU2UdEcYkQY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018