UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vxgBNXIHbMZ/lj3JdvoDQxMMpksp+0dKpgbOBfbr8Lw=' 
WHERE 
  key_id = '4d245c6385ff323e34e98d7508c6057542ea347bf4eb51ebfa8778fd2bff4951' 
  AND (
    token = 'vxgBNXIHbMZ/lj3JdvoDQxMMpksp+0dKpgbOBfbr8Lw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031