UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wot7qDvaKGr48apguSXd8q1oxefDPk2fQ/loxYfNVS0=' 
WHERE 
  key_id = '5f59377670a028220c40ae856d648a9416b8963cc0c8c6e783360116ce33c8df' 
  AND (
    token = 'wot7qDvaKGr48apguSXd8q1oxefDPk2fQ/loxYfNVS0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042