UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YcUtH0FBFgqH6csCKLK/n2XBN/qiXHjijTBG0/efvGI=' 
WHERE 
  key_id = 'baca995d866560974ac89356c2cc664f56b18723350155382f420358a7f117e6' 
  AND (
    token = 'YcUtH0FBFgqH6csCKLK/n2XBN/qiXHjijTBG0/efvGI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037