UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x2iPJPXaz8cc/QKn4805rIbpyE//ZBqIkKcslRbKbwE=' 
WHERE 
  key_id = '0e95b59701b5a0275d1d81847e06c8806e16ef081ee508b0d8e39a26e7432239' 
  AND (
    token = 'x2iPJPXaz8cc/QKn4805rIbpyE//ZBqIkKcslRbKbwE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041