UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jwWxkycW6terLC5q+/O86Gu//lEbV+yv10F/IBFQqns=' 
WHERE 
  key_id = 'd1c9cb707520da763534bf14f84f0afff96cccb4b3e7870c25c0b9a57403937c' 
  AND (
    token = 'jwWxkycW6terLC5q+/O86Gu//lEbV+yv10F/IBFQqns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026